<?php

namespace app\api\controller\logistics;


use app\common\controller\qyg\Api;
use think\Exception;
use think\Request;

class Terminal extends Api
{

    public $noNeedRight = "*";

    public $noNeedLogin = ["search_list"];

    protected $service;

    public function __construct()
    {
        parent::__construct();
        $this->service = new \app\common\service\logistics\Terminal();
    }

    public function search_express(Request  $request)
    {

        try {
            $user_id    = isset($this->auth)?$this->auth->id:0;
            $lat        = $request->param("lat");
            $lnt        = $request->param("lnt");
            $page       = $request->param("page",1);
            $page_size  = $request->param("page_size",200);
            $data       = $this->service->search_express($user_id,$lat,$lnt,$page,$page_size);
            $this->success("ok",$data);
        }catch (Exception $e){
            $this->error($e->getMessage());
        }
    }

    public function search_order(Request  $request)
    {

        try {
            $lat        = $request->param("lat");
            $lnt        = $request->param("lnt");
            $page       = $request->param("page",1);
            $page_size  = $request->param("page_size",200);
            $data       = $this->service->search_order($lat,$lnt,$page,$page_size);
            $this->success("ok",$data);
        }catch (Exception $e){
            $this->error($e->getMessage());
        }
    }

    public function get_express(Request  $request)
    {

        try {
            $express_id  = $request->param("express_id");
            $data       = $this->service->get_express($express_id);
            $this->success("ok",$data);
        }catch (Exception $e){
            $this->error($e->getMessage());
        }
    }
}